package org.nepu.scr.indexrate.converter.longevityrate;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.longevityrate.ResultC52;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class ResultC52Converter implements AttributeConverter<ResultC52, String> {
    @Override
    public String convertToDatabaseColumn(ResultC52 resultC52) {
        return JSONUtil.toJsonStr(resultC52);
    }

    @Override
    public ResultC52 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, ResultC52.class);
    }
}
